﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AsyncroneModule
{
   /// <summary>
   /// Class used to check whether Vitals and Numbers are currently represented in the system internal representation
   /// </summary>
   static public class SyntaxCheck
   {
      // Regular expression to check Vitals against
      const String checkExVitals = "^([1-9][0-9]{1,2}[ ]){2}[1-9][0-9]{1,2}$";

      // Regular expression to check Number against
      const String checkExNumbers = "^[+][0-9]{5,20}$";

      /// <summary>
      /// Checks string against predefined regex 
      /// </summary>
      /// <param name="str"> String to check </param>
      /// <returns> true if str passed the validation, false otherwise </returns>
      public static bool checkSyntaxVitals(String str)
      {
         Regex  checker = new Regex(checkExVitals);
         return checker.IsMatch(str);
      }
   
      /// <summary>
      /// Checks string against predefined regex
      /// </summary>
      /// <param name="str"> String to check </param>
      /// <returns> true if str passed the validation, false otherwise </returns>
      public static bool CheckSyntaxNumber(String str)
      {
         // Regular expression to check converted number against
         Regex  checker = new Regex(checkExNumbers);
         return checker.IsMatch(str);
      }
   }
}
